<template>
	<view>
		<uni-popup ref="popup" type="bottom">
			<view class="bg-white ">
				<uni-section title="多条件查询" type="circle">
					<template v-slot:right>
						<view @click="close">关闭</view>
					</template>
				</uni-section>
				<view class="padding-bottom-lg padding-sm" style="padding-bottom: 120rpx;">
					<uni-forms class="margin-sm" labelWidth="160rpx">
						<uni-forms-item label="学生姓名">
							<uni-easyinput v-model="queryFrom.student_name" placeholder="学生姓名"></uni-easyinput>
						</uni-forms-item>

						<uni-forms-item label="家长手机号">
							<uni-easyinput v-model="queryFrom.parentsInfo_phone" placeholder="家长手机号"></uni-easyinput>
						</uni-forms-item>

						<uni-forms-item label="创建时间">
							<uni-datetime-picker v-model="queryFrom.createTime" type="daterange"
								@maskClick="maskClick" />
						</uni-forms-item>
						<slot :dict="dict"></slot>
					</uni-forms>
					<button @click="submitForm" class="login-btn cu-btn block bg-blue lg round">查询</button>
				</view>
			</view>
		</uni-popup>
	</view>
</template>

<script>
	import {
		formatTime
	} from '@/utils/validate'
	export default {
		data() {
			return {
				queryFrom: {
					createTime: []
				},
				dict: {}
			}
		},
		props: {},
		mounted() {

		},
		created() {

		},
		methods: {
			open(data) {
				this.dict.VipContractStartus = this.$getDictList("VipContractStartus");
				// uni.hideTabBar();
				this.queryFrom = data
				this.$refs.popup.open()
				this.dict.checkInStatus = this.$getDictList("checkInStatus");

				this.dict.offline_class_name = this.$getDictList("offline_class_name");
				for (let s of this.dict.offline_class_name) {
					s.text = s.dictName
					s.value = s.dictValue
				}

			},
			async submitForm() {
				Object.assign(this.$data, this.$options.data());
				this.$refs.popup.close()
				if (this.queryFrom.createTime != null && this.queryFrom.createTime.length == 2) {
					this.queryFrom.createTime_BEGIN = this.queryFrom.createTime[0]
					this.queryFrom.createTime_END = this.queryFrom.createTime[1]
				}
				if (this.queryFrom.startClassDate != null && this.queryFrom.startClassDate.length == 2) {
					this.queryFrom.startClassDate_BEGIN = this.queryFrom.startClassDate[0]
					this.queryFrom.startClassDate_END = this.queryFrom.startClassDate[1]
				}


				this.$emit('refresh', this.queryFrom)

			},

			close() {
				Object.assign(this.$data, this.$options.data());
				this.$refs.popup.close()

				this.$emit('refresh')
			},
		}
	}
</script>

<style>
</style>